org.jboss.byteman.contrib.dtest
Class InstrumentedClass

java.lang.Object
  extended by org.jboss.byteman.contrib.dtest.InstrumentedClass
All Implemented Interfaces:
java.rmi.Remote, RemoteInterface

public class InstrumentedClass
extends java.lang.Object
implements RemoteInterface

InstrumentedClass instances serve two purposes: Internally to the framework they provide a communication endpoint for receiving information from the remote, Byteman instrumented code execution. To the framework user, they provide utility methods for verifying expectations relating to that remote execution e.g. the number of method calls made.

Author:
Jonathan Halliday (jonathan.halliday@redhat.com) 2010-05

Method Summary
 void assertKnownInstances(int count)
          Checks that the number of known, distinct object instances of this class is as stated.
 void assertMethodCallCount(java.lang.String message, java.lang.String methodName, CallCount callCount)
          Checks that the number of known invocations of the given method falls within the specified range for each known instances of the class.
 void assertMethodCalled(java.lang.String methodName)
          Checks that the given method has been called at least once on each known instance of the class.
 void assertMethodNotCalled(java.lang.String methodName)
          Checks that the given method has not been seen to be called on any known instance of the class.
 java.util.Set<InstrumentedInstance> getInstances()
          Returns the set of known instances of the class.
 void trace(java.lang.String methodName, java.lang.Object[] args)
          Receiving side of the remote communication between the test code and the BytemanTestHelper.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

trace

public void trace(java.lang.String methodName,
                  java.lang.Object[] args)
           throws java.rmi.RemoteException
Receiving side of the remote communication between the test code and the BytemanTestHelper.

Specified by:
trace in interface RemoteInterface
Parameters:
methodName - the method name that was traced.
args - the arguments to the method invocation, in String form.
Throws:
java.rmi.RemoteException - in case of communication failure.
See Also:
BytemanTestHelper.remoteTrace(String, String, Object[])

getInstances

public java.util.Set<InstrumentedInstance> getInstances()
Returns the set of known instances of the class.

Returns:
a Set of Objects representing instances of the class.

assertKnownInstances

public void assertKnownInstances(int count)
Checks that the number of known, distinct object instances of this class is as stated.

Parameters:
count - the expected number of instances of the class.

assertMethodCallCount

public void assertMethodCallCount(java.lang.String message,
                                  java.lang.String methodName,
                                  CallCount callCount)
Checks that the number of known invocations of the given method falls within the specified range for each known instances of the class.

Parameters:
message - the message to print in case of assertion failure.
methodName - the method name to look for.
callCount - the expected range for the invocation count.

assertMethodCalled

public void assertMethodCalled(java.lang.String methodName)
Checks that the given method has been called at least once on each known instance of the class. Uses junit internally, hence expect the normal exception throwing in case of failure.

Parameters:
methodName - the method name to look for.

assertMethodNotCalled

public void assertMethodNotCalled(java.lang.String methodName)
Checks that the given method has not been seen to be called on any known instance of the class. Uses junit internally, hence expect the normal exception throwing in case of failure.

Parameters:
methodName - the method name to look for.


Copyright © 2012. All Rights Reserved.